package core
{
	import alternativa.engine3d.core.Object3D;
	import alternativa.engine3d.loaders.LoaderOBJ;
	import alternativa.engine3d.primitives.Box;
	
	import flash.events.Event;

	public class Player extends Object3D
	{
		private var _loader:LoaderOBJ
		
		public function Player(name:String=null)
		{
			super(name);
			init();
		}
		
		private function init():void
		{
			this.addChild(Factory.createCube());
			
			_loader = new LoaderOBJ();
			_loader.addEventListener(Event.COMPLETE, onLoaded);
			//_loader.load("testcraft.obj");
		}
		
		private function onLoaded(e:Event):void
		{
			var obj:Object3D =  Object3D(_loader.content);
	
			obj.scaleX = obj.scaleY = obj.scaleZ = 100;
			this.addChild(obj);	
			addChild(new Box);
		}
		
	}
}